mines <- minesRaw %>% #filter to key energy transition minerals
  filter (CRITICAL_MINERAL %in% c("Aluminum",
                                  "Cadmium",
                                  "Cobalt",
                                  "Copper",
                                  "Dysprosium",
                                  "Gallium",
                                  "Indium",
                                  "Lithium",
                                  "Manganese",
                                  "Neodymium",
                                  "Nickel",
                                  "Silver",
                                  "Selenium",
                                  "Tellurium",
                                  "Rare-Earth Elements"))

minesKeyMinerals <- minesRaw %>% #filter to key energy transition minerals
  filter (CRITICAL_MINERAL %in% c("Cobalt",
                                  "Lithium",
                                  "Tellurium",
                                  "Rare-Earth Elements"))
map3 <- ggplot() + 
  geom_polygon(data=state, #add base map
               color = "black", 
               fill="white",
               aes(x=long, y=lat, group=group)) + 
  geom_point(data=minesKeyMinerals, #add mines
             aes(x=LONGITUDE, y=LATITUDE, color=CRITICAL_MINERAL,
                 text=paste("",CRITICAL_MINERAL))) +
  theme_minimal()+ #remove grey background
  theme(legend.position="none", #remove legend, axes labels/ticks
        axis.title.x=element_blank(), 
        axis.text.x=element_blank(), 
        axis.ticks.x=element_blank(),
        axis.title.y=element_blank(), 
        axis.text.y=element_blank(), 
        axis.ticks.y=element_blank()) + 
  ggtitle('"Critical Mineral" Mines & Deposits in U.S.:<br>Cobalt, Lithium, Tellurium, Rare Earths') +
  coord_fixed(1.3) #adjust aspect ratio

ggplotly(map3, tooltip="text") %>% #make interactive
  style(hoverinfo="none", traces=1)
# map4 <- ggplot() + 
#   geom_sf(data=county_simpl, #add base map
#                color = NA, 
#                aes(fill=estimate)) + 
#   coord_sf()+
#   scale_fill_viridis_c(option = "magma") +
#   geom_point(data=minesKeyMinerals, #add mines
#              aes(x=LONGITUDE, y=LATITUDE, color=CRITICAL_MINERAL,
#                  text=paste("",CRITICAL_MINERAL))) +
#   theme_minimal()+ #remove grey background
#   #theme(legend.position="none", #remove legend, axes labels/ticks
#         # axis.title.x=element_blank(), 
#         # axis.text.x=element_blank(), 
#         # axis.ticks.x=element_blank(),
#         # axis.title.y=element_blank(), 
#         # axis.text.y=element_blank(), 
#         # axis.ticks.y=element_blank()) + 
#   ggtitle('"Critical Mineral" Mines & Deposits in U.S.:<br>Cobalt, Lithium, Tellurium, Rare Earths') 
#  # coord_fixed(1.3) #adjust aspect ratio
# 
# ggplotly(map4, tooltip="text") %>% #make interactive
#   style(hoverinfo="none", traces=1)
#buf35miles <- st_buffer(iowa_methodist, dist = 50)